import 'dart:ui';

import 'package:flutter/material.dart';

class ColorsUtil {

  static const Color black_333 = Color(0xff333333);
  static const Color black_666 = Color(0xff666666);
  static const Color black_999 = Color(0xff999999);
  static const Color grey_999 = Color(0xff999999);
  static const Color grey_line = Color(0xffe4e4e4);
  static const Color blue_dark1 = Color(0xff1759fa);
  static const Color blue_dark2 = Color(0xff477bfc);
  static const Color green_32ce33 = Color(0xff32ce33);
  static const Color red_ff606f = Color(0xffff606f);
  static const Color orange_ffa500 = Color(0xFFFFA500);
  static const Color orange_ff8c00 = Color(0xFFFF8C00);

  static Color view_background = Color(0xFFEFF0F1);
  static Color white = Color(0xFFFFFFFFF);
  static Color line_action_background = Color(0xFFFFFFFF);
  static Color btn_background = Color(0xFF3A94FF);
  static Color txt_main = Color(0xff333333);
  static Color txt_normal = Color(0xff666666);
  static Color txt_descript = Color(0xff999999);
  static Color txt_alarm = Color(0xffff606f);
  static Color txt_warning = Color(0xFFFFA500);
  static Color activeBgColor = Color(0xff1759fa);


  /// 十六进制颜色，
  /// hex, 十六进制值，例如：0xffffff,
  /// alpha, 透明度 [0.0,1.0]
  static Color hexColor(int hex,{double alpha = 1}){
    if (alpha < 0){
      alpha = 0;
    }else if (alpha > 1){
      alpha = 1;
    }
    return Color.fromRGBO((hex & 0xFF0000) >> 16 ,
        (hex & 0x00FF00) >> 8,
        (hex & 0x0000FF) >> 0,
        alpha);
  }


  /// 十六进制颜色，
  /// hex, 十六进制值，例如：#ffffff,
  static Color hexStrColor(String s, {double alpha = 1}) {
    int hex=int.parse(s.replaceAll("#", "").replaceAll("0x", ""), radix: 16) + 0xFF000000;

    return ColorsUtil.hexColor(hex, alpha:alpha);
  }
}